<template>
  <view class="page-container">
    <!-- 顶部区域 -->
    <view class="smart-page-head">
      <view class="header-content">
        <text class="page-title">Flex 布局演示</text>
        <text class="page-desc">展示不同方向的 Flex 布局效果</text>
      </view>
    </view>
    
    <!-- 主体部分 -->
    <view class="content-wrapper">
      <!-- 横向布局示例 -->
      <view class="example-section">
        <view class="section-header">
          <text class="section-title">flex-direction: row 横向布局</text>
          <text class="section-info">子元素水平排列</text>
        </view>
        
        <!-- 横向布局容器及子项 -->
        <view class="flex-container row-layout">
          <view class="flex-item item-1">A</view>
          <view class="flex-item item-2">B</view>
          <view class="flex-item item-3">C</view>
        </view>
      </view>
      
      <!-- 纵向布局示例 -->
      <view class="example-section">
        <view class="section-header">
          <text class="section-title">flex-direction: column 纵向布局</text>
          <text class="section-info">子元素垂直排列</text>
        </view>
        
        <!-- 纵向布局容器及子项 -->
        <view class="flex-container column-layout">
          <view class="flex-item item-1">A</view>
          <view class="flex-item item-2">B</view>
          <view class="flex-item item-3">C</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      // 可以在这里定义数据
    }
  },
  methods: {
    // 可以在这里定义方法
  }
}
</script>

<style scoped>
.page-container {
  min-height: 100vh;
  background-color: #f5f7fa;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 顶部区域样式 */
.smart-page-head {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  padding: 40rpx 30rpx 60rpx;
  border-radius: 0 0 30rpx 30rpx;
  box-shadow: 0 4rpx 15rpx rgba(37, 99, 235, 0.15);
}

.header-content {
  max-width: 900rpx;
  margin: 0 auto;
}

.page-title {
  color: #ffffff;
  font-size: 38rpx;
  font-weight: 600;
  display: block;
  margin-bottom: 15rpx;
  text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}

.page-desc {
  color: rgba(255, 255, 255, 0.85);
  font-size: 26rpx;
  line-height: 1.5;
}

/* 内容区域样式 */
.content-wrapper {
  padding: 40rpx 30rpx;
  max-width: 900rpx;
  margin: 0 auto;
}

/* 示例区块样式 */
.example-section {
  background-color: #ffffff;
  border-radius: 20rpx;
  padding: 30rpx;
  margin-bottom: 35rpx;
  box-shadow: 0 3rpx 12rpx rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.example-section:hover {
  transform: translateY(-3rpx);
  box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.08);
}

/* 区块标题样式 */
.section-header {
  margin-bottom: 25rpx;
  padding-bottom: 15rpx;
  border-bottom: 1px solid #f1f5f9;
}

.section-title {
  font-size: 30rpx;
  font-weight: 600;
  color: #1e293b;
  display: block;
  margin-bottom: 8rpx;
}

.section-info {
  font-size: 24rpx;
  color: #64748b;
}

/* Flex 容器样式 */
.flex-container {
  display: flex;
  border-radius: 12rpx;
  overflow: hidden;
  position: relative;
  padding: 2rpx;
  background-color: #f1f5f9;
}

/* 横向布局 */
.row-layout {
  flex-direction: row;
  height: 200rpx;
  gap: 4rpx;
}

/* 纵向布局 */
.column-layout {
  flex-direction: column;
  height: 450rpx;
  gap: 4rpx;
}

/* Flex 子项样式 */
.flex-item {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 40rpx;
  font-weight: bold;
  color: #ffffff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  z-index: 1;
}

.flex-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.05);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.flex-item:active::after {
  opacity: 1;
}

.flex-item:active {
  transform: scale(0.98);
}

/* 子项颜色 */
.item-1 {
  background-color: #3b82f6;
}

.item-2 {
  background-color: #10b981;
}

.item-3 {
  background-color: #ef4444;
}
</style>